﻿///////////////////////////////////////////////////////////////
// This is generated code. 
//////////////////////////////////////////////////////////////
// Code is generated using LLBLGen Pro version: 3.5
// Code is generated on: Monday, December 17, 2012 11:21:26 AM
// Code is generated using templates: SD.TemplateBindings.SharedTemplates.NET20
// Templates vendor: Solutions Design.
// Templates version: 
//////////////////////////////////////////////////////////////
using System;
using System.Collections;
using System.Collections.Generic;
using WHMS;
using WHMS.FactoryClasses;
using WHMS.HelperClasses;
using SD.LLBLGen.Pro.ORMSupportClasses;

namespace WHMS.RelationClasses
{
	/// <summary>Implements the relations factory for the entity: Transaction. </summary>
	public partial class TransactionRelations
	{
		/// <summary>CTor</summary>
		public TransactionRelations()
		{
		}

		/// <summary>Gets all relations of the TransactionEntity as a list of IEntityRelation objects.</summary>
		/// <returns>a list of IEntityRelation objects</returns>
		public virtual List<IEntityRelation> GetAllRelations()
		{
			List<IEntityRelation> toReturn = new List<IEntityRelation>();
			toReturn.Add(this.DepositTransactionEntityUsingTransactionId);
			toReturn.Add(this.RetrievalTransactionEntityUsingTransactionId);
			toReturn.Add(this.TransactionItemEntityUsingTransactionId);
			toReturn.Add(this.TransferTransactionEntityUsingTransactionId);
			toReturn.Add(this.WithdrawTransactionEntityUsingTransactionId);
			toReturn.Add(this.ProjectEntityUsingProjectId);
			return toReturn;
		}

		#region Class Property Declarations

		/// <summary>Returns a new IEntityRelation object, between TransactionEntity and DepositTransactionEntity over the 1:n relation they have, using the relation between the fields:
		/// Transaction.Id - DepositTransaction.TransactionId
		/// </summary>
		public virtual IEntityRelation DepositTransactionEntityUsingTransactionId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany, "DepositTransactions" , true);
				relation.AddEntityFieldPair(TransactionFields.Id, DepositTransactionFields.TransactionId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("TransactionEntity", true);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("DepositTransactionEntity", false);
				return relation;
			}
		}

		/// <summary>Returns a new IEntityRelation object, between TransactionEntity and RetrievalTransactionEntity over the 1:n relation they have, using the relation between the fields:
		/// Transaction.Id - RetrievalTransaction.TransactionId
		/// </summary>
		public virtual IEntityRelation RetrievalTransactionEntityUsingTransactionId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany, "RetrievalTransactions" , true);
				relation.AddEntityFieldPair(TransactionFields.Id, RetrievalTransactionFields.TransactionId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("TransactionEntity", true);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("RetrievalTransactionEntity", false);
				return relation;
			}
		}

		/// <summary>Returns a new IEntityRelation object, between TransactionEntity and TransactionItemEntity over the 1:n relation they have, using the relation between the fields:
		/// Transaction.Id - TransactionItem.TransactionId
		/// </summary>
		public virtual IEntityRelation TransactionItemEntityUsingTransactionId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany, "TransactionItems" , true);
				relation.AddEntityFieldPair(TransactionFields.Id, TransactionItemFields.TransactionId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("TransactionEntity", true);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("TransactionItemEntity", false);
				return relation;
			}
		}

		/// <summary>Returns a new IEntityRelation object, between TransactionEntity and TransferTransactionEntity over the 1:n relation they have, using the relation between the fields:
		/// Transaction.Id - TransferTransaction.TransactionId
		/// </summary>
		public virtual IEntityRelation TransferTransactionEntityUsingTransactionId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany, "TransferTransactions" , true);
				relation.AddEntityFieldPair(TransactionFields.Id, TransferTransactionFields.TransactionId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("TransactionEntity", true);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("TransferTransactionEntity", false);
				return relation;
			}
		}

		/// <summary>Returns a new IEntityRelation object, between TransactionEntity and WithdrawTransactionEntity over the 1:n relation they have, using the relation between the fields:
		/// Transaction.Id - WithdrawTransaction.TransactionId
		/// </summary>
		public virtual IEntityRelation WithdrawTransactionEntityUsingTransactionId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany, "WithdrawTransactions" , true);
				relation.AddEntityFieldPair(TransactionFields.Id, WithdrawTransactionFields.TransactionId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("TransactionEntity", true);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("WithdrawTransactionEntity", false);
				return relation;
			}
		}


		/// <summary>Returns a new IEntityRelation object, between TransactionEntity and ProjectEntity over the m:1 relation they have, using the relation between the fields:
		/// Transaction.ProjectId - Project.Id
		/// </summary>
		public virtual IEntityRelation ProjectEntityUsingProjectId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.ManyToOne, "Project", false);
				relation.AddEntityFieldPair(ProjectFields.Id, TransactionFields.ProjectId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("ProjectEntity", false);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("TransactionEntity", true);
				return relation;
			}
		}
		/// <summary>stub, not used in this entity, only for TargetPerEntity entities.</summary>
		public virtual IEntityRelation GetSubTypeRelation(string subTypeEntityName) { return null; }
		/// <summary>stub, not used in this entity, only for TargetPerEntity entities.</summary>
		public virtual IEntityRelation GetSuperTypeRelation() { return null;}
		#endregion

		#region Included Code

		#endregion
	}
	
	/// <summary>Static class which is used for providing relationship instances which are re-used internally for syncing</summary>
	internal static class StaticTransactionRelations
	{
		internal static readonly IEntityRelation DepositTransactionEntityUsingTransactionIdStatic = new TransactionRelations().DepositTransactionEntityUsingTransactionId;
		internal static readonly IEntityRelation RetrievalTransactionEntityUsingTransactionIdStatic = new TransactionRelations().RetrievalTransactionEntityUsingTransactionId;
		internal static readonly IEntityRelation TransactionItemEntityUsingTransactionIdStatic = new TransactionRelations().TransactionItemEntityUsingTransactionId;
		internal static readonly IEntityRelation TransferTransactionEntityUsingTransactionIdStatic = new TransactionRelations().TransferTransactionEntityUsingTransactionId;
		internal static readonly IEntityRelation WithdrawTransactionEntityUsingTransactionIdStatic = new TransactionRelations().WithdrawTransactionEntityUsingTransactionId;
		internal static readonly IEntityRelation ProjectEntityUsingProjectIdStatic = new TransactionRelations().ProjectEntityUsingProjectId;

		/// <summary>CTor</summary>
		static StaticTransactionRelations()
		{
		}
	}
}
